﻿using System;
using YunSpace.Core;

namespace YunSpace.Application.Messaging.Sender
{
    public class EmailSender : MessageSender
    {

        public override void Send()
        {
            var mail = new MailHelper
            {
                MailServer = Configs.GetValue("MailHost"),
                MailUserName = Configs.GetValue("MailUserName"),
                MailPassword = Configs.GetValue("MailPassword"),
                MailName = "YunSpace快速开发平台"
            };

            mail.Send(Email, Title, Content);
            //Console.WriteLine("发送 Email");
        }

        protected override BeforeSendValidateState Validate()
        {
            return Email.IsEmpty() ? BeforeSendValidateState.EmptyEmail : BeforeSendValidateState.Ok;
        }
    }
}
